﻿/***
  \brief  КЛасс дата и время
*/


#pragma once



#include <iostream>
//#error
#include <math.h>

#include <stdlib.h>

#include "core_api.h"


//! \brief  Дата.
class CORE_API  Date
{
public:
	Date ();
	Date (int mn, int day, int yr);  // constructor

	void display();                  // function to display date
	int GetMonth();
	void SetMonth(int mn);

	bool operator < (const Date& a) const;
	bool operator == (const Date& a) const 
	{
		return  (year == a.year) && (month == a.month) && (day == a.day) ;
	}

	void operator = (const std::string& a) throw (std::runtime_error);
	operator std::string() const;


	~Date();

private:
	int month, day, year;
	int DaysSoFar();
};



/********************************************************************
void main()
{
	Date mydate(1, 2, 1993);
	Date date2(4,12,1994);
	Date date4;
	Date *date3;
	Date *date6;
	Date date5(1,1,1);

	date3 = new Date(45,45,44545);

	mydate.display();
	date2.display();
	date3->display();


	cout << "OK: " << date3->GetMonth() << '\n';
	date3->SetMonth(4);
	cout << "OK: " << date3->GetMonth() << '\n';

	delete(date3);
	date6 = new Date(1,1,1);

	cout << "OK: " << date3->GetMonth() << '\n';
	date3->SetMonth(4);
	cout << "OK: " << date3->GetMonth() << '\n';

	date3->display();

	date4.display();

	date5.SetMonth(3);
	delete(date6);
********************************************************************/